#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-48,ch=getchar();}
	return x*f;
}
int n,T;

signed main(){
	freopen("tree.in","r",stdin);
	freopen("tree.out","w",stdout);
	T=read();
	while(T--){
		n=read();
		if(n==0){
			puts("2");
			continue;
		}
		int f=sqrt(n),ans=n;
		for(int i=-100;i<=100;i++)
			if(f*(f+i)<=n&&f+i>0)
				ans=min(f+f-1+i+(n-f*(f+i)+f+i-1)/(f+i)+(f*(f+i)!=n&&((n-f*(f+i))%(f+i))%2!=((f+i)&1)),min(f+f-1+i+(n-f*(f+i)+f-1)/(f)+(f*(f+i)!=n&&((n-f*(f+i))%f)%2!=(f&1)),ans));
		printf("%lld\n",ans+2);
	}
    return 0;
}